package com.cloudfactory.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.cloudfactory.service.ServiceService;
import com.cloudfactory.vo.ServiceVo;

@Controller
@RequestMapping(value = "/")
public class ServiceController {

	@Autowired
	private ServiceService serviceService;

	@RequestMapping(value = "/service")
	public String service(Model model) {
		model.addAttribute("serviceCategoryList", serviceService.selectAllCategory());
		model.addAttribute("serviceVoList", serviceService.selectAllServiceVo());
		return "/service.jsp";
	}

	@RequestMapping(value = "/service-content")
	public String serviceContent(Model model, @RequestParam("id") Long id) {
		ServiceVo serviceVo = serviceService.selectServiceVoById(id);
		model.addAttribute("serviceVo", serviceVo);
		return "/service-content.jsp";
	}

}
